//
//  YiDaUser.swift
//  YiDa
//
//  Created by zhoufei on 16/6/26.
//  Copyright © 2016年 ZhouFei. All rights reserved.
//

import  Foundation

class YiDaUser: NSObject {
    var userId:Int32?
    var tel:String?
    var password:String?
    var inviter:String?
    
    class var main:YiDaUser{
        struct Static {
            static let  instance:YiDaUser = YiDaUser()
        }
        return Static.instance
    }
    
    func isLogin()->Bool
    {
        if   let _userId:String = NSUserDefaults.standardUserDefaults().stringForKey("userId"){
            self.userId = Int32(_userId)
            return true
        }
        return false
    }
    
    func saveDefault(){
        if let _userId = self.userId{
            NSUserDefaults.standardUserDefaults().setValue(String(_userId), forKeyPath: "userId")
        }
    }

}
